<html>
	<head>
		<title>c.f. - Locus</title>
		<link rel="stylesheet" type="text/css" href="locus.css" />
	</head>
	
	<body>

	    <!-- chat/log pane -->
	    <div id="outerChatPane">
	        
	        <div id="chatDisplayPane"></div>
	        <div id="chatEntryPane">
	            <input type="text" id="chatInput" /><button id="chatSubmitButton">Say</button>
	        </div>
	    
	    </div>
	
		<!-- TODO: need a toggleable floating 'lightbox' in the middle of our map -->
	
	    <!-- map pane -->
	    <div>
	    </div>
	    
	    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
		<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
		<script src="ContinualFlame.Ajax.js"></script>
	    
	    <script type="text/javascript">

	        $(document).ready(function() {

	            // load the controller code for our local client
	            locusClient = new LocusClient();

	            //
	            // wire up DOM events
	            //

	            $("#chatSubmitButton").click(function() {

	                locusClient.SendMessage({
	                    Type: "ChatCommand",
	                    Command: $('#chatInput').val()
	                });

	            });

	            // TODO: extract margin from CSS (don't hardcode presentation in JS)
	            $(window).resize(function() {
	                $("#chatDisplayPane").height($(window).height() - 75);
	            });

	            // force layout calcuation on first load
	            $(window).resize();

	            //
	            // data bind DOM objects to server-side events
	            //

	            locusClient.RegisterEventHandler("globalChatStream", "ChatContent", function(msg) {
	                alert("new chat response: " + msg.Content);
	            });

	            // extract page ID from current URL
	            var gameId = /id=([0-9a-fA-F-]+)/.exec(window.location.href)[1];

	            // connect to service and start streaming events
	            locusClient.Connect(gameId);
	        })
	          
	    </script>

	</body>
</html>